package com.chuangyang.fixboxmaster.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.chuangyang.fixboxmaster.R;
import com.chuangyang.fixboxmaster.bean.CashInfo;


/**
 * Created by vanshu on 15/8/1 14:21.
 */
public class CashRequest2Activity extends BaseActivity implements View.OnClickListener {
    private Button mBtnCashRequest;
    private TextView mBalance;
    private CashInfo cashInfo;
    private TextView mMonthIntegration;
    private TextView mTotalIntegration;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        cashInfo= (CashInfo) getIntent().getSerializableExtra("cashInfo");
        setContentView(R.layout.activity_cash_request);
        setTitle("账户余额");

        TextView mTodaySalary=(TextView)findViewById(R.id.tv_today_salary);
        mTodaySalary.setText(String.valueOf(cashInfo.todayBalance));
        TextView mBalance=(TextView)findViewById(R.id.tv_balance);
        mBalance.setText(cashInfo.balance); //账户余额
        TextView mRemainBalance=(TextView)findViewById(R.id.tv_remain_balance);
        mRemainBalance.setText(cashInfo.cash);//可用余额
        TextView mOrderCount=(TextView)findViewById(R.id.tv_order_count);
        mOrderCount.setText(String.valueOf(cashInfo.orderDoneNumber));
        TextView mInCome=(TextView)findViewById(R.id.tv_total_salary);
        mInCome.setText(String.valueOf(cashInfo.totalBalance));
        mBtnCashRequest = (Button) findViewById(R.id.btn_request_cash);
        mBtnCashRequest.setOnClickListener(this);

        mMonthIntegration=(TextView)findViewById(R.id.month_integration);
        mTotalIntegration=(TextView)findViewById(R.id.all_integration);
        mMonthIntegration.setText(String.valueOf(cashInfo.monthIntegration));
        mTotalIntegration.setText(String.valueOf(cashInfo.totalIntegration));
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_request_cash:
                Intent intentCashRequest = new Intent(this, CashRequestActivity.class);
                intentCashRequest.putExtra("cashInfo",cashInfo);
                startActivity(intentCashRequest);
                break;
        }
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.balance_detail_menu, menu);
        return super.onCreateOptionsMenu(menu);
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case R.id.menu_balance_detail:
                startActivity(new Intent(CashRequest2Activity.this,BalanceDetailActivity.class));
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }



}
